home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / SQLException.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  2.0 KB  |  69 lines

  1. package symjava.sql;
  2.  
  3. public class SQLException extends Exception {
  4.    private String SQLState;
  5.    private int vendorCode;
  6.    private SQLException next;
  7.  
  8.    public SQLException(String reason, String SQLState, int vendorCode) {
  9.       super(reason);
  10.       this.SQLState = SQLState;
  11.       this.vendorCode = vendorCode;
  12.       if (!(this instanceof SQLWarning) && DriverManager.getLogStream() != null) {
  13.          DriverManager.println("SQLException: SQLState(" + SQLState + ") vendor code(" + vendorCode + ")");
  14.          ((Throwable)this).printStackTrace(DriverManager.getLogStream());
  15.       }
  16.  
  17.    }
  18.  
  19.    public SQLException(String reason, String SQLState) {
  20.       super(reason);
  21.       this.SQLState = SQLState;
  22.       this.vendorCode = 0;
  23.       if (!(this instanceof SQLWarning) && DriverManager.getLogStream() != null) {
  24.          ((Throwable)this).printStackTrace(DriverManager.getLogStream());
  25.          DriverManager.println("SQLException: SQLState(" + SQLState + ")");
  26.       }
  27.  
  28.    }
  29.  
  30.    public SQLException(String reason) {
  31.       super(reason);
  32.       this.SQLState = null;
  33.       this.vendorCode = 0;
  34.       if (!(this instanceof SQLWarning) && DriverManager.getLogStream() != null) {
  35.          ((Throwable)this).printStackTrace(DriverManager.getLogStream());
  36.       }
  37.  
  38.    }
  39.  
  40.    public SQLException() {
  41.       this.SQLState = null;
  42.       this.vendorCode = 0;
  43.       if (!(this instanceof SQLWarning) && DriverManager.getLogStream() != null) {
  44.          ((Throwable)this).printStackTrace(DriverManager.getLogStream());
  45.       }
  46.  
  47.    }
  48.  
  49.    public String getSQLState() {
  50.       return this.SQLState;
  51.    }
  52.  
  53.    public int getErrorCode() {
  54.       return this.vendorCode;
  55.    }
  56.  
  57.    public SQLException getNextException() {
  58.       return this.next;
  59.    }
  60.  
  61.    public synchronized void setNextException(SQLException ex) {
  62.       SQLException theEnd;
  63.       for(theEnd = this; theEnd.next != null; theEnd = theEnd.next) {
  64.       }
  65.  
  66.       theEnd.next = ex;
  67.    }
  68. }
  69.